{% if courseSet.type == 'open' or courseSet.type == 'liveOpen' %}
  {% set layout = 'open-course-manage/layout.html.twig' %}
{% else %}
  {% set layout = 'courseset-manage/courseset-layout.html.twig' %}
{% endif %}
{% extends layout %}
{% do script(['app/js/course-manage-file/index/index.js']) %}

{% block title %}{{'course.course_files'|trans}} - {{ parent() }}{% endblock %}

{% set side_nav = 'files' %}
{% set tab = 'courseLesson' %}



{% block main %}
  {% if courseSet.type in ['open','liveOpen'] %}
    {% set targetType = 'opencoursematerial' %}
  {% else %}
    {% set targetType = 'coursematerial' %}
  {% endif %}
  <div role="courseset-manage-file">
    <div class="courseset-manage-body__title">
      <a class="cd-btn cd-btn-info cd-btn-sm  courseset-manage-body__btn"
        data-toggle="modal" data-target="#modal"
        data-url="{{path('uploader_batch_upload', {token:uploader_token(targetType, courseSet.id, 'private')}) }}"
      >
        <i class="glyphicon glyphicon-cloud-upload mrs"></i>{{'course.course_files.create_btn'|trans}}
      </a>
      {{'course.course_files.content_title'|trans}}
    </div>

    <div id="file-manage-panel" data-file-status-url="{{path('course_set_manage_file_status')}}">
      <table class="table table-striped table-hover" id="course-lesson-table">
        <thead>
          <tr>
            <th width="5%"><input type="checkbox"  data-role="batch-select"></th>
            <th width="30%">{{'course.course_files.name'|trans}}</th>
            <th>{{'course.course_files.type'|trans}}</th>
            <th>{{'course.course_files.size'|trans}}</th>
            <th>{{'course.course_files.use_status'|trans}}</th>
            <th>{{'course.course_files.last_update'|trans}}</th>
            <th>{{'course.course_files.operation'|trans}}</th>
          </tr>
        </thead>
        <tbody>

          {% for uploadFile in files if uploadFile %}
            {% include 'courseset-manage/file/tbody-tr.html.twig' %}
          {% else %}
            <tr class="empty"><td colspan="20">{{'course.course_files.empty'|trans}}</td></tr>
          {% endfor %}

        </tbody>
      </table>

      <label class="checkbox-inline mrm mbm"><input type="checkbox" data-role="batch-select"> {{'course.course_files.select_all_btn'|trans}}</label>

      <div class="btn-group mbm">
        {% if courseSet.type == 'normal' or courseSet.type =='live'  %}
          <button class="cd-btn cd-btn-danger cd-btn-sm" data-role="batch-delete" data-name="{{'course.course_files.record'|trans}}" data-url="{{ path('course_set_manage_delete_materials_show', {id:courseSet.id, type:tab}) }}">
        {% elseif courseSet.type == 'open' or courseSet.type == 'liveOpen' %}
          <button class="cd-btn cd-btn-danger cd-btn-sm" data-role="batch-delete" data-name="{{'course.course_files.record'|trans}}" data-url="{{ path('open_course_manage_delete_materials_show', {id:courseSet.id, type:tab}) }}">
        {% endif %}
        <i class="glyphicon glyphicon-trash"></i>
        {{'form.btn.remove'|trans}}</button>
      </div>

      <nav class="text-center">
        {{ web_macro.paginator(paginator) }}
      </nav>

    </div>
  </div>
{% endblock %}
